package ph.com.gs3.formalistics.managers;

import ph.com.gs3.formalistics.R;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;

public class FLNotificationManager {

	public static final String TAG = FLNotificationManager.class.getSimpleName();

	// ========================================================================
	// Notification IDs

	public static final int NOTIFICATION_SIGNING_IN_ID = 1;

	// ========================================================================
	// other fields

	private Context context;
	private NotificationManager notificationManager;

	public FLNotificationManager(Context context) {
		this.context = context;
		notificationManager = (NotificationManager) context
		        .getSystemService(Context.NOTIFICATION_SERVICE);
	}

	@SuppressWarnings("deprecation")
	private Notification buildSigningInNotification(String email) {

		//	@formatter:off
		Notification.Builder builder = new Notification.Builder(context)
					.setContentTitle("Signing in...")
					.setContentText(email)
					.setSmallIcon(R.drawable.ic_launcher);
		//	@formatter:on

		// return builder.build();
		return builder.getNotification();

	}

	public void notifySigningIn(String email) {

		Notification notification = buildSigningInNotification(email);
		notificationManager.notify(NOTIFICATION_SIGNING_IN_ID, notification);

	}

	public void dismissSigningIn() {
		notificationManager.cancel(NOTIFICATION_SIGNING_IN_ID);
	}

}
